package com.example.happiness.mapper;

import com.example.happiness.pojo.Category;
import com.example.happiness.pojo.admindto.UcategoryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
@Mapper
public interface CategoryMapper {
    int deleteByPrimaryKey(Integer cid);

    int insert(Category record);

    int insertSelective(Category record);

    Category selectByPrimaryKey(Integer cid);

    int updateByPrimaryKeySelective(Category record);

    int updateByPrimaryKey(Category record);

    @Select("select cid, cname, state,image,createtime from category;")
    List<Category> selectCategory();

    @Update("update category set state =#{state} where cid=#{cid}")
    void updatestate(UcategoryDTO ucategoryDTO);

    @Select("select cid, cname, state from category where state=#{one}")
    List<Category> getAllCategory(Integer one);
}